package com.wb.core1;

import java.net.SocketOption;
import java.security.spec.RSAOtherPrimeInfo;
import java.util.Scanner;

/**
 * @author 黄衡熙
 * @version 1.0
 * @date 2025年07月15日11:44
 */
// 练习二
// 在控制台输入指定的年份与月份
// 计算出这一年的这个月共有多少天,考虑闰年
//采用if else语句
public class Test6 {
    public static void main(String[] args) {
        while(true) {
            Scanner sc = new Scanner(System.in);
            System.out.print("请输入年份:");
            int year = sc.nextInt();
            System.out.print("请输入月份:");
            int month = sc.nextInt();
            if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
                if (month == 1) {
                    System.out.println(year + "年" + month + "月有31天！");
                } else if (month == 2) {
                    System.out.println(year + "年" + month + "月有29天！");
                } else if (month == 3) {
                    System.out.println(year + "年" + month + "月有31天！");
                } else if (month == 4) {
                    System.out.println(year + "年" + month + "月有30天！");
                } else if (month == 5) {
                    System.out.println(year + "年" + month + "月有31天！");
                } else if (month == 6) {
                    System.out.println(year + "年" + month + "月有30天！");
                } else if (month == 7) {
                    System.out.println(year + "年" + month + "月有31天！");
                } else if (month == 8) {
                    System.out.println(year + "年" + month + "月有31天！");
                } else if (month == 9) {
                    System.out.println(year + "年" + month + "月有3o天！");
                } else if (month == 10) {
                    System.out.println(year + "年" + month + "月有31天！");
                } else if (month == 11) {
                    System.out.println(year + "年" + month + "月有30天！");
                } else {
                    System.out.println(year + "年" + month + "月有31天！");
                }

            } else {
                if (month == 1) {
                    System.out.println(year + "年" + month + "月有31天！");
                } else if (month == 2) {
                    System.out.println(year + "年" + month + "月有28天！");
                } else if (month == 3) {
                    System.out.println(year + "年" + month + "月有31天！");
                } else if (month == 4) {
                    System.out.println(year + "年" + month + "月有30天！");
                } else if (month == 5) {
                    System.out.println(year + "年" + month + "月有31天！");
                } else if (month == 6) {
                    System.out.println(year + "年" + month + "月有30天！");
                } else if (month == 7) {
                    System.out.println(year + "年" + month + "月有31天！");
                } else if (month == 8) {
                    System.out.println(year + "年" + month + "月有31天！");
                } else if (month == 9) {
                    System.out.println(year + "年" + month + "月有3o天！");
                } else if (month == 10) {
                    System.out.println(year + "年" + month + "月有31天！");
                } else if (month == 11) {
                    System.out.println(year + "年" + month + "月有30天！");
                } else {
                    System.out.println(year + "年" + month + "月有31天！");
                }
            }

        }

    }
}
